home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / winsrc.arc / LOADFILE.C < prev    next >
Text File  |  1991-06-16  |  20KB  |  657 lines

  1. /*
  2.     loadfile.c - load an existing fractal image, control level
  3.     This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
  4. */
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include "fractint.h"
  10. #include "fractype.h"
  11. #include "targa_lc.h"
  12.  
  13. /* routines in this module    */
  14.  
  15. void loadfile_overlay(void);
  16. int  read_overlay(void);
  17.  
  18. static int  find_fractal_info(char *,struct fractal_info *);
  19. static void load_ext_blk(char far *loadptr,int loadlen);
  20. static void skip_ext_blk(int *,int *);
  21. static void backwardscompat();
  22.  
  23. int filetype;
  24. int loaded3d;
  25.  
  26. extern int    showfile;         /* has file been displayed yet? */
  27. extern char   readname[];        /* name of fractal input file */
  28. extern char   far *resume_info;     /* pointer to resume info if alloc'd */
  29. extern int    resume_len;        /* length of resume info */
  30. extern int    adapter;
  31. extern int    calc_status;
  32. extern int    initmode;         /* initial video mode        */
  33. extern long   calctime;
  34. extern int    initbatch;        /* 1 if batch run (no kbd)  */
  35. extern int    maxit;
  36. extern int    initincr;         /* maxiter incrmnt        */
  37. extern char   usr_stdcalcmode;        /* pass mode            */
  38. extern int    fractype;         /* fractal type         */
  39. extern double xxmin,xxmax;        /* corner values        */
  40. extern double yymin,yymax;        /* corner values        */
  41. extern double xx3rd,yy3rd;        /* corner values        */
  42. extern double param[4];         /* parameters            */
  43. extern int    inside;            /* inside color: 1=blue     */
  44. extern int    outside;            /* outside color, if set    */
  45. extern int    finattract;        /* finite attractor option  */
  46. extern int    forcesymmetry;
  47. extern int    LogFlag;            /* non-zero if logarithmic palettes */
  48. extern int    rflag, rseed;
  49. extern int    usr_periodicitycheck;
  50. extern char   useinitorbit;
  51. extern struct complex initorbit;
  52. extern int    potflag;            /* continuous potential flag */
  53. extern int    pot16bit;
  54. extern double potparam[3];        /* three potential parameters*/
  55. extern double inversion[];
  56. extern int    decomp[];
  57. extern int    usr_distest;        /* non-zero if distance estimator   */
  58. extern int    distestwidth;
  59. extern int    init3d[20];        /* '3d=nn/nn/nn/...' values */
  60. extern char   usr_floatflag;        /* floating-point fractals? */
  61. extern int    usr_biomorph;
  62. extern char   FormName[];
  63. extern char   LName[];
  64. extern char   IFSName[];
  65. extern int    bailout;            /* user input bailout value */
  66. extern int    previewfactor;
  67. extern int    xtrans;
  68. extern int    ytrans;
  69. extern int    red_crop_left;
  70. extern int    red_crop_right;
  71. extern int    blue_crop_left;
  72. extern int    blue_crop_right;
  73. extern int    red_bright;
  74. extern int    blue_bright;
  75. extern int    xadjust;
  76. extern int    eyeseparation;
  77. extern int    glassestype;
  78. extern int    display3d;        /* 3D display flag: 0 = OFF */
  79. extern int    overlay3d;        /* 3D overlay flag: 0 = OFF */
  80. extern int    viewwindow;        /* 0 for full screen, 1 for window */
  81. extern float  viewreduction;        /* window auto-sizing */
  82. extern float  finalaspectratio;     /* for view shape and rotation */
  83. extern int    xdots, ydots;        /* # of dots on the logical screen */
  84. extern int    viewxdots,viewydots;    /* explicit view sizing */
  85. extern int    save_system,save_release;
  86. extern int    Ambient;
  87. extern int    RANDOMIZE;
  88. extern int    haze;
  89. extern int    transparent[2];
  90. extern int    rotate_lo,rotate_hi;
  91. extern int far *ranges;
  92. extern int    rangeslen;
  93. extern int    invert;
  94.  
  95. static FILE *fp;
  96.  
  97. int fileydots, filexdots, filecolors;
  98. float fileaspectratio;
  99.  
  100. int skipxdots,skipydots;    /* for decoder, when reducing image */
  101.  
  102.  
  103. void loadfile_overlay() { }    /* for restore_active_ovly */
  104.  
  105.  
  106. int read_overlay()    /* read overlay/3D files, if reqr'd */
  107. {
  108.    struct fractal_info read_info;
  109.    char oldfloatflag;
  110.    char msg[110];
  111.  
  112.    ENTER_OVLY(OVLY_LOADFILE);
  113.  
  114.    showfile = 1;        /* for any abort exit, pretend done */
  115.    initmode = -1;        /* no viewing mode set yet */
  116.    oldfloatflag = usr_floatflag;
  117.    loaded3d = 0;
  118.  
  119.    if(strchr(readname,'.') == NULL)
  120.       strcat(readname,".gif");
  121.  
  122.    if(find_fractal_info(readname,&read_info)) { /* didn't find a useable file */
  123.       sprintf(msg,"Sorry, %s isn't a file I can decode.",readname);
  124.       stopmsg(0,msg);
  125.       EXIT_OVLY;
  126.       return(-1);
  127.       }
  128.  
  129.    maxit    = read_info.iterations;
  130.    fractype    = read_info.fractal_type;
  131.    curfractalspecific = &fractalspecific[fractype];
  132.    xxmin    = read_info.xmin;
  133.    xxmax    = read_info.xmax;
  134.    yymin    = read_info.ymin;
  135.    yymax    = read_info.ymax;
  136.    param[0]    = read_info.creal;
  137.    param[1]    = read_info.cimag;
  138.    save_release = 1100; /* unless we find out better later on */
  139.  
  140.    invert = 0;
  141.    if(read_info.version > 0) {
  142.       param[2]        = read_info.parm3;
  143.       roundfloatd(¶m[2]);
  144.       param[3]        = read_info.parm4;
  145.       roundfloatd(¶m[3]);
  146.       potparam[0]   = read_info.potential[0];
  147.       potparam[1]   = read_info.potential[1];
  148.       potparam[2]   = read_info.potential[2];
  149.       potflag        = (potparam[0] != 0.0);
  150.       rflag        = read_info.rflag;
  151.       rseed        = read_info.rseed;
  152.       inside        = read_info.inside;
  153.       LogFlag        = read_info.logmap;
  154.       inversion[0]  = read_info.invert[0];
  155.       inversion[1]  = read_info.invert[1];
  156.       inversion[2]  = read_info.invert[2];
  157.       if (inversion[0] != 0.0)
  158.      invert = 3;
  159.       decomp[0]     = read_info.decomp[0];
  160.       decomp[1]     = read_info.decomp[1];
  161.       usr_biomorph  = read_info.biomorph;
  162.       forcesymmetry = read_info.symmetry;
  163.       }
  164.  
  165.    if(read_info.version > 1) {
  166.       save_release  = 1200;
  167.       if (!display3d
  168.     && (read_info.version <= 4 || read_info.flag3d > 0
  169.         || (curfractalspecific->flags&PARMS3D) )) {
  170.      int i;
  171.      for (i = 0; i < 16; i++)
  172.         init3d[i] = read_info.init3d[i];
  173.      previewfactor     = read_info.previewfactor;
  174.      xtrans      = read_info.xtrans;
  175.      ytrans      = read_info.ytrans;
  176.      red_crop_left     = read_info.red_crop_left;
  177.      red_crop_right  = read_info.red_crop_right;
  178.      blue_crop_left  = read_info.blue_crop_left;
  179.      blue_crop_right = read_info.blue_crop_right;
  180.      red_bright     = read_info.red_bright;
  181.      blue_bright     = read_info.blue_bright;
  182.      xadjust     = read_info.xadjust;
  183.      eyeseparation     = read_info.eyeseparation;
  184.      glassestype     = read_info.glassestype;
  185.      }
  186.       }
  187.  
  188.    if(read_info.version > 2) {
  189.       save_release = 1300;
  190.       outside       = read_info.outside;
  191.       }
  192.  
  193.    calc_status = 0;      /* defaults if version < 4 */
  194.    xx3rd = xxmin;
  195.    yy3rd = yymin;
  196.    usr_distest = 0;
  197.    calctime = 0;
  198.    if(read_info.version > 3) {
  199.       save_release = 1400;
  200.       xx3rd      = read_info.x3rd;
  201.       yy3rd      = read_info.y3rd;
  202.       calc_status = read_info.calc_status;
  203.       usr_stdcalcmode = read_info.stdcalcmode;
  204.       usr_distest     = read_info.distest;
  205.       usr_floatflag   = read_info.floatflag;
  206.       bailout      = read_info.bailout;
  207.       calctime      = read_info.calctime;
  208.       trigndx[0]  = read_info.trigndx[0];
  209.       trigndx[1]  = read_info.trigndx[1];
  210.       trigndx[2]  = read_info.trigndx[2];
  211.       trigndx[3]  = read_info.trigndx[3];
  212.       finattract  = read_info.finattract;
  213.       initorbit.x = read_info.initorbit[0];
  214.       initorbit.y = read_info.initorbit[1];
  215.       useinitorbit = read_info.useinitorbit;
  216.       usr_periodicitycheck = read_info.periodicity;
  217.       }
  218.  
  219.    pot16bit = 0;
  220.    save_system = 0;
  221.    if(read_info.version > 4) {
  222.       pot16bit       = read_info.pot16bit;
  223.       if (pot16bit)
  224.      filexdots >>= 1;
  225.       fileaspectratio = read_info.faspectratio;
  226.       if (fileaspectratio < 0.01)    /* fix files produced in early v14.1 */
  227.      fileaspectratio = SCREENASPECT;
  228.       save_system  = read_info.system;
  229.       save_release = read_info.release; /* from fmt 5 on we know real number */
  230.       if (read_info.version == 5    /* except a few early fmt 5 cases: */
  231.       && (save_release <= 0 || save_release >= 2000)) {
  232.      save_release = 1410;
  233.      save_system = 0;
  234.      }
  235.       if (!display3d && read_info.flag3d > 0) {
  236.      loaded3d    = 1;
  237.      Ambient    = read_info.ambient;
  238.      RANDOMIZE    = read_info.randomize;
  239.      haze        = read_info.haze;
  240.      transparent[0] = read_info.transparent[0];
  241.      transparent[1] = read_info.transparent[1];
  242.      }
  243.       }
  244.  
  245.    rotate_lo = 1; rotate_hi = 255;
  246.    distestwidth = 71;
  247.    if(read_info.version > 5) {
  248.       rotate_lo     = read_info.rotate_lo;
  249.       rotate_hi     = read_info.rotate_hi;
  250.       distestwidth    = read_info.distestwidth;
  251.       }
  252.  
  253.    if(read_info.version > 6) {
  254.       param[2]        = read_info.dparm3;
  255.       param[3]        = read_info.dparm4;
  256.       }
  257.  
  258.    if(read_info.version < 4) { /* pre-version 14.0? */
  259.       backwardscompat(&read_info); /* translate obsolete types */
  260.       if(LogFlag)
  261.      LogFlag = 2;
  262.       usr_floatflag = (curfractalspecific->isinteger) ? 0 : 1;
  263.       }
  264.  
  265.    if (read_info.version < 5) { /* pre-version 15.0? */
  266.       if (LogFlag == 2) /* logmap=old changed again in format 5! */
  267.      LogFlag = -1;
  268.       if (decomp[0] > 0 && decomp[1] > 0)
  269.      bailout = decomp[1];
  270.       }
  271.  
  272.    set_trig_pointers(-1);
  273.  
  274.    if (display3d)            /* PB - a klooge till the meaning of */
  275.       usr_floatflag = oldfloatflag; /*    floatflag in line3d is clarified */
  276.  
  277.    if (overlay3d) {
  278.       initmode = adapter;       /* use previous adapter mode for overlays */
  279.       if (filexdots > xdots || fileydots > ydots) {
  280.      static char far msg[]={"Can't overlay with a larger image"};
  281.      stopmsg(0,msg);
  282.      EXIT_OVLY;
  283.      initmode = -1;
  284.      return(-1);
  285.      }
  286.       }
  287.    else {
  288.       int olddisplay3d,i;
  289.       olddisplay3d = display3d;
  290.       display3d = loaded3d; /* for <tab> display during next */
  291.       i = get_video_mode(&read_info);
  292.       display3d = olddisplay3d;
  293.       if (i) {
  294.      EXIT_OVLY;
  295.      initmode = -1;
  296.      return(-1);
  297.      }
  298.       }
  299.  
  300.    if (display3d) {
  301.       calc_status = 0;
  302.       fractype = PLASMA;
  303.       curfractalspecific = &fractalspecific[PLASMA];
  304.       param[0] = 0;
  305.       if (!initbatch)
  306.      if (get_3d_params() < 0) {
  307.         EXIT_OVLY;
  308.         initmode = -1;
  309.         return(-1);
  310.         }
  311.       }
  312.  
  313.    showfile = 0;           /* trigger the file load */
  314.  
  315.    EXIT_OVLY;
  316.    return(0);
  317. }
  318.  
  319.  
  320. static int find_fractal_info(gif_file,info)
  321. char *gif_file;
  322. struct fractal_info *info;
  323. {
  324.    unsigned char gifstart[18];
  325.    char temp1[81];
  326.    int scan_extend, block_type, block_len, data_len;
  327.    int fractinf_len;
  328.    int hdr_offset;
  329.    int i;
  330.  
  331.    if((fp = fopen(gif_file,"rb"))==NULL)
  332.       return(-1);
  333.  
  334.    fread(gifstart,18,1,fp);
  335.    if (strncmp(gifstart,"GIF",3)!=0) { /* not GIF, maybe old .tga? */
  336.       if(fread(info,sizeof(struct fractal_info),1,fp)==1 &&
  337.          strncmp(info->info_id,"Fractal",8)==0) {
  338.      filetype = 1; /* Targa 16 */
  339.      fileydots = *(int *)&gifstart[O_VSIZE];
  340.      filexdots = *(int *)&gifstart[O_HSIZE];
  341.      filecolors = info->colors;
  342.      fileaspectratio = SCREENASPECT;
  343.      if(fileydots == info->ydots && filexdots == info->xdots) {
  344.         fclose(fp);
  345.         return(0);
  346.         }
  347.      }
  348.       fclose(fp);
  349.       return(-1);
  350.       }
  351.  
  352.    filetype = 0; /* GIF */
  353.    filexdots = gifstart[7]*256+gifstart[6];
  354.    fileydots = gifstart[9]*256+gifstart[8];
  355.    filecolors = 2 << (gifstart[10] & 7);
  356.    fileaspectratio = 0; /* unknown */
  357.    if (gifstart[12]) { /* calc reasonably close value from gif header */
  358.       fileaspectratio = (64.0 / ((double)(gifstart[12]) + 15.0))
  359.               * (double)fileydots / (double)filexdots;
  360.       if ( fileaspectratio > SCREENASPECT-0.03
  361.     && fileaspectratio < SCREENASPECT+0.03)
  362.      fileaspectratio = SCREENASPECT;
  363.       }
  364.    else
  365.       if (fileydots * 4 == filexdots * 3) /* assume the common square pixels */
  366.      fileaspectratio = SCREENASPECT;
  367.  
  368.    if (resume_info != NULL) { /* free the prior area if there is one */
  369.       farmemfree(resume_info);
  370.       resume_info = NULL;
  371.       }
  372.    if (rangeslen) { /* free prior ranges */
  373.       farmemfree((char far *)ranges);
  374.       rangeslen = 0;
  375.       }
  376.  
  377.    /* Format of .gif extension blocks is:
  378.       1 byte    '!', extension block identifier
  379.       1 byte    extension block number, 255
  380.       1 byte    length of id, 11
  381.      11 bytes   alpha id, "fractintnnn" with fractint, nnn is secondary id
  382.        n * {
  383.       1 byte    length of block info in bytes
  384.       x bytes   block info
  385.        }
  386.       1 byte    0, extension terminator
  387.       To scan extension blocks, we first look in file at length of fractal_info
  388.       (the main extension block) from end of file, looking for a literal known
  389.       to be at start of our block info.  Then we scan forward a bit, in case
  390.       the file is from an earlier fractint vsn with shorter fractal_info.
  391.       If fractal_info is found and is from vsn>=14, it includes the total length
  392.       of all extension blocks; we then scan them all first to last to load
  393.       any optional ones which are present.
  394.       Defined extension blocks:
  395.     fractint001    header, always present
  396.     fractint002    resume info for interrupted resumable image
  397.     fractint003    additional formula type info
  398.     fractint004    ranges info
  399.    */
  400.  
  401.    memset(info,0,sizeof(FRACTAL_INFO));
  402.    fractinf_len = sizeof(FRACTAL_INFO) + (sizeof(FRACTAL_INFO)+254)/255;
  403.    fseek(fp,(long)(-1-fractinf_len),SEEK_END);
  404.    fread(info,1,sizeof(FRACTAL_INFO),fp);
  405.    if (strcmp(INFO_ID,info->info_id) == 0)
  406.       hdr_offset = -1-fractinf_len;
  407.    else {
  408.       /* didn't work 1st try, maybe an older vsn, maybe junk at eof, scan: */
  409.       int offset,i;
  410.       char tmpbuf[110];
  411.       hdr_offset = 0;
  412.       offset = 80; /* don't even check last 80 bytes of file for id */
  413.       while (offset < fractinf_len+513) { /* allow 512 garbage at eof */
  414.      offset += 100; /* go back 100 bytes at a time */
  415.      fseek(fp,(long)(0-offset),SEEK_END);
  416.      fread(tmpbuf,1,110,fp); /* read 10 extra for string compare */
  417.      for (i = 0; i < 100; ++i)
  418.         if (!strcmp(INFO_ID,&tmpbuf[i])) { /* found header? */
  419.            strcpy(info->info_id,INFO_ID);
  420.            fseek(fp,(long)(hdr_offset=i-offset),SEEK_END);
  421.            fread(info,1,sizeof(FRACTAL_INFO),fp);
  422.            offset = 10000; /* force exit from outer loop */
  423.            break;
  424.            }
  425.      }
  426.       }
  427.  
  428.    if (hdr_offset) { /* we found INFO_ID */
  429.  
  430.       if (info->version >= 4) {
  431.      /* first reload main extension block, reasons:
  432.           might be over 255 chars, and thus earlier load might be bad
  433.           find exact endpoint, so scan back to start of ext blks works
  434.         */
  435.      fseek(fp,(long)(hdr_offset-15),SEEK_END);
  436.      scan_extend = 1;
  437.      while (scan_extend) {
  438.         if (fgetc(fp) != '!' /* if not what we expect just give up */
  439.           || fread(temp1,1,13,fp) != 13
  440.           || strncmp(&temp1[2],"fractint",8))
  441.            break;
  442.         temp1[13] = 0;
  443.         block_type = atoi(&temp1[10]); /* e.g. "fractint002" */
  444.         switch (block_type) {
  445.            case 1: /* "fractint001", the main extension block */
  446.           if (scan_extend == 2) { /* we've been here before, done now */
  447.              scan_extend = 0;
  448.              break;
  449.              }
  450.           load_ext_blk((char far *)info,sizeof(FRACTAL_INFO));
  451.           scan_extend = 2;
  452.           /* now we know total extension len, back up to first block */
  453.           fseek(fp,0L-info->tot_extend_len,SEEK_CUR);
  454.           break;
  455.            case 2: /* resume info */
  456.           skip_ext_blk(&block_len,&data_len); /* once to get lengths */
  457.           if ((resume_info = farmemalloc((long)data_len)) == NULL)
  458.              info->calc_status = 3; /* not resumable after all */
  459.           else {
  460.              fseek(fp,(long)(0-block_len),SEEK_CUR);
  461.              load_ext_blk(resume_info,data_len);
  462.              resume_len = data_len;
  463.              }
  464.           break;
  465.            case 3: /* formula info */
  466.           {
  467.           char *nameptr;
  468.           char tmpname[40];
  469.           load_ext_blk(tmpname,40);
  470.           switch (info->fractal_type) {
  471.              case LSYSTEM:
  472.             nameptr = LName;
  473.             break;
  474.              case IFS:
  475.              case IFS3D:
  476.             nameptr = IFSName;
  477.             break;
  478.              default:
  479.             nameptr = FormName;
  480.             break;
  481.              }
  482.           tmpname[ITEMNAMELEN] = 0;
  483.           strcpy(nameptr,tmpname);
  484.           /* perhaps in future add more here, check block_len for
  485.              backward compatibility */
  486.           }
  487.           break;
  488.            case 4: /* ranges info */
  489.           skip_ext_blk(&block_len,&data_len); /* once to get lengths */
  490.           if ((ranges = (int far *)farmemalloc((long)data_len))) {
  491.              fseek(fp,(long)(0-block_len),SEEK_CUR);
  492.              load_ext_blk((char far *)ranges,data_len);
  493.              rangeslen = data_len/2;
  494.              }
  495.           break;
  496.            default:
  497.           skip_ext_blk(&block_len,&data_len);
  498.            }
  499.         }
  500.      }
  501.  
  502.       fclose(fp);
  503.       fileaspectratio = SCREENASPECT; /* if not >= v15, this is correct */
  504.       return(0);
  505.       }
  506.  
  507.    strcpy(info->info_id, "GIFFILE");
  508.    info->iterations = 150;
  509.    info->fractal_type = PLASMA;
  510.    info->xmin = -1;
  511.    info->xmax = 1;
  512.    info->ymin = -1;
  513.    info->ymax = 1;
  514.    info->x3rd = -1;
  515.    info->y3rd = -1;
  516.    info->creal = 0;
  517.    info->cimag = 0;
  518.    info->videomodeax=255;
  519.    info->videomodebx=255;
  520.    info->videomodecx=255;
  521.    info->videomodedx=255;
  522.    info->dotmode = 0;
  523.    info->xdots = filexdots;
  524.    info->ydots = fileydots;
  525.    info->colors = filecolors;
  526.    info->version = 0; /* this forces lots more init at calling end too */
  527.  
  528.    /* zero means we won */
  529.    fclose(fp);
  530.    return(0);
  531. }
  532.  
  533. static void load_ext_blk(char far *loadptr,int loadlen)
  534. {
  535.    int len;
  536.    while ((len = fgetc(fp)) > 0) {
  537.       while (--len >= 0) {
  538.      if (--loadlen >= 0)
  539.         *(loadptr++) = fgetc(fp);
  540.      else
  541.         fgetc(fp); /* discard excess characters */
  542.      }
  543.       }
  544. }
  545.  
  546. static void skip_ext_blk(int *block_len, int *data_len)
  547. {
  548.    int len;
  549.    *data_len = 0;
  550.    *block_len = 1;
  551.    while ((len = fgetc(fp)) > 0) {
  552.       fseek(fp,(long)len,SEEK_CUR);
  553.       *data_len += len;
  554.       *block_len += len + 1;
  555.       }
  556. }
  557.  
  558.  
  559. /* switch obsolete fractal types to new generalizations */
  560. static void backwardscompat(struct fractal_info *info)
  561. {
  562.    switch(fractype) {
  563.       case LAMBDASINE:
  564.      fractype = LAMBDATRIGFP;
  565.      trigndx[0] = SIN;
  566.      break;
  567.       case LAMBDACOS    :
  568.      fractype = LAMBDATRIGFP;
  569.      trigndx[0] = COS;
  570.      break;
  571.       case LAMBDAEXP    :
  572.      fractype = LAMBDATRIGFP;
  573.      trigndx[0] = EXP;
  574.      break;
  575.       case MANDELSINE    :
  576.      fractype = MANDELTRIGFP;
  577.      trigndx[0] = SIN;
  578.      break;
  579.       case MANDELCOS    :
  580.      fractype = MANDELTRIGFP;
  581.      trigndx[0] = COS;
  582.      break;
  583.       case MANDELEXP    :
  584.      fractype = MANDELTRIGFP;
  585.      trigndx[0] = EXP;
  586.      break;
  587.       case MANDELSINH    :
  588.      fractype = MANDELTRIGFP;
  589.      trigndx[0] = SINH;
  590.      break;
  591.       case LAMBDASINH    :
  592.      fractype = LAMBDATRIGFP;
  593.      trigndx[0] = SINH;
  594.      break;
  595.       case MANDELCOSH    :
  596.      fractype = MANDELTRIGFP;
  597.      trigndx[0] = COSH;
  598.      break;
  599.       case LAMBDACOSH    :
  600.      fractype = LAMBDATRIGFP;
  601.      trigndx[0] = COSH;
  602.      break;
  603.       case LMANDELSINE    :
  604.      fractype = MANDELTRIG;
  605.      trigndx[0] = SIN;
  606.      break;
  607.       case LLAMBDASINE    :
  608.      fractype = LAMBDATRIG;
  609.      trigndx[0] = SIN;
  610.      break;
  611.       case LMANDELCOS    :
  612.      fractype = MANDELTRIG;
  613.      trigndx[0] = COS;
  614.      break;
  615.       case LLAMBDACOS    :
  616.      fractype = LAMBDATRIG;
  617.      trigndx[0] = COS;
  618.      break;
  619.       case LMANDELSINH    :
  620.      fractype = MANDELTRIG;
  621.      trigndx[0] = SINH;
  622.      break;
  623.       case LLAMBDASINH    :
  624.      fractype = LAMBDATRIG;
  625.      trigndx[0] = SINH;
  626.      break;
  627.       case LMANDELCOSH    :
  628.      fractype = MANDELTRIG;
  629.      trigndx[0] = COSH;
  630.      break;
  631.       case LLAMBDACOSH    :
  632.      fractype = LAMBDATRIG;
  633.      trigndx[0] = COSH;
  634.      break;
  635.       case LMANDELEXP    :
  636.      fractype = MANDELTRIG;
  637.      trigndx[0] = EXP;
  638.      break;
  639.       case LLAMBDAEXP    :
  640.      fractype = LAMBDATRIG;
  641.      trigndx[0] = EXP;
  642.      break;
  643.       case DEMM     :
  644.      fractype = MANDELFP;
  645.      usr_distest = (info->ydots - 1) * 2;
  646.      break;
  647.       case DEMJ     :
  648.      fractype = JULIAFP;
  649.      usr_distest = (info->ydots - 1) * 2;
  650.      break;
  651.       case MANDELLAMBDA :
  652.      useinitorbit = 2;
  653.      break;
  654.       }
  655.    curfractalspecific = &fractalspecific[fractype];
  656. }
  657.